<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Floor_model extends CI_Model
{
	/**
	 * 查看
	 */
	public function chak()
	{
		$arr = $this->db->select('*')->from('floor')
				->join('type','floor.house_type=type.type_id')
				->order_by('floor_id','descr')->get()
				->result_array();
		return $arr;
	}
	/**
	 * 添加
	 * [add description]
	 * @param [type] $data [description]
	 */
	public function add($data)
	{
		$res=$this->db->insert('floor',$data);
		return $res;
	}
	/**
	 * 修改查看
	 */
	public function updas($id)
	{
		$arr = $this->db->where(array('floor_id'=>$id))->get('floor')->result_array();
		foreach ($arr as $v) {
			$arr = $v;
		}
			return $arr;
	}
		/**
	 * 修改之数据处理
	 */
	public function update($id,$data)
	{
		$arr= $this->db->update('floor',$data,array('floor_id'=>$id));
		return $arr;
	}
		/**
	 * 删除
	 */
	public function del($id)
	{
		$bool = $this->db->delete('floor',array('floor_id'=>$id));
		return $bool;
	}
	/**
	 * 给房屋添加分类用,需要id,和楼盘编号
	 */
	public function huset_check()
	{
		$arr = $this->db->select('floor_id,floor_sn,sub_area')->get('floor')->result_array();
		return $arr;
	}
}